﻿package mortal.game.scene3D.util
{
    import com.mui.controls.*;
    import extend.language.*;
    import mortal.game.cache.*;

    public class SceenOperation extends Object
    {
        private static var _interDoubleRestAlert:Boolean = false;

        public function SceenOperation()
        {
            return;
        }// end function

        public static function interruptDoubleRest(param1:Function, param2:Function = null) : void
        {
            var callback:* = param1;
            var cancelCallback:* = param2;
            if (_interDoubleRestAlert)
            {
                cancelCallback.call();
                return;
            }
            var closeHandler:* = function (param1:int) : void
            {
                _interDoubleRestAlert = false;
                if (Alert.YES == param1)
                {
                    if (callback is Function)
                    {
                        callback();
                    }
                }
                if (cancelCallback != null && Alert.NO == param1)
                {
                    cancelCallback.call();
                }
                return;
            }// end function
            ;
            if (Cache.instance.role.roleEntityInfo.isDoubleZazen)
            {
                Alert.show(Language.getString(20680), null, Alert.YES | Alert.NO, null, closeHandler);
                _interDoubleRestAlert = true;
            }
            else if (callback is Function)
            {
                SceenOperation.callback();
            }
            return;
        }// end function

        public static function interruptToAI(param1:Function, param2:Function = null) : void
        {
            if (Cache.instance.role.roleEntityInfo.isDoubleZazen)
            {
                interruptDoubleRest(param1, param2);
            }
            else if (param1 != null)
            {
                SceenOperation.param1();
            }
            return;
        }// end function

    }
}
